package com.yeyks.common.em.vip;

/**
 * vip分佣比例配置表
 * @author: dagny
 * @date: 2019/8/22 0022 14:00
 */
public enum VipCommissionRateConfigEnum {
    //vip分佣比例配置信息
    card_Hotel(1,2000, "卡酒店"),
    card_Operate(2,750, "卡运营商"),
    no_card_Hotel(5,2000, "非卡酒店"),
    no_card_Operate(6,750, "非卡运营商"),
    card_Business(9,300,"卡商")
    ;

    private int type;

    /**
     * 万分比
     */
    private int rateValue;

    private String desc;

    VipCommissionRateConfigEnum(int type, int rateValue, String desc) {
        this.type = type;
        this.rateValue = rateValue;
        this.desc = desc;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public int getRateValue() {
        return rateValue;
    }

    public void setRateValue(int rateValue) {
        this.rateValue = rateValue;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    /**
     * 根据type获取比例
     * @param type 类型
     * @return 返回万分比例
     */
    public static Integer getRateValueByType(Integer type){
        for(VipCommissionRateConfigEnum vipEnum:VipCommissionRateConfigEnum.values()){
            if(type.equals(vipEnum.getType())){
                return vipEnum.getRateValue();
            }
        }
        return  null;
    }

    /**
     * 根据type获取desc
     * @param type 类型
     * @return 返回desc
     */
    public static String getDescByType(Integer type){
        for(VipCommissionRateConfigEnum vipEnum:VipCommissionRateConfigEnum.values()){
            if(type.equals(vipEnum.getType())){
                return vipEnum.getDesc();
            }
        }
        return  null;
    }

}
